﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace Excersises
{
    class Program
    {
        public static void PrintBytes(string s)
        {
            for (int i = 0; i < s.Length; i++)
            {
                Console.Write("\\x{0:x2}", (int)s[i]);
            }
            Console.WriteLine();
        }

        public static void PrintColumn()
        {
            for (int i = 5; i < 25; i++)
            {
                Console.WriteLine("{0,5}|{1:0.0000}|{1:00000.0000}|{2}", i, Math.Sqrt(i), Math.Log(i, Math.E));
            }
        }

        public static void PrintCurrency(double num)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-AT");
            Console.WriteLine("{0:C}", num);
            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("bg-BG");
            Console.WriteLine("{0:C}", num);
            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("he-IL");
            Console.WriteLine("{0:C}", num);
            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("mn-MN");
            Console.WriteLine("{0:C}", num);
            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("th-TH");
            Console.WriteLine("{0:C}", num);
            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
            Console.WriteLine("{0:C}", num);
        }

        private static void PrintBytesInEncoding(Encoding encoding, string str)
        {
            byte[] bytes = encoding.GetBytes(str);
            foreach (byte current in bytes)
            {
                Console.Write("\\x{0:X2}",current);
            }
            Console.WriteLine();
        }

        public static void PrintAllEncodings(string str)
        {
            EncodingInfo[] encodingNames = Encoding.GetEncodings();

            foreach (EncodingInfo encodingName in encodingNames)
            {
                PrintBytesInEncoding(Encoding.GetEncoding(encodingName.Name),str);
            }
        }

        public static void Main()
        {
            PrintAllEncodings("Niki");
        }
    }
}
